﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CourseArraging.UControl;
using System.ComponentModel;
using System.Windows.Forms; 
using System.Drawing;
using Stone.DataContracts;

namespace CourseArraging.Frm.xygl
{
    /// <summary>
    /// 版权所有
    /// 石世特@温州医学院 sst330381@gmail.com
    /// </summary> 
    public class FrmStuItem : FrmControlBase
    {
        // Fields
        private IContainer components;

        // Methods
        public FrmStuItem()
        {
            this.components = null;
            this.InitializeComponent();
            ShowData(null,null);
        }

        public FrmStuItem(string tmpno,string time)
        {
            this.components = null;
            this.InitializeComponent();
            this.ShowData(tmpno,time);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public override object GetEntity(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return null;
            }
            DataGridView view = (DataGridView)sender;
            StuEntity entity = new StuEntity();
            entity.user_id = int.Parse(view.Rows[e.RowIndex].Cells["学员信息流水"].Value.ToString());
            entity.user_no = view.Rows[e.RowIndex].Cells["学员编号"].Value.ToString();
            entity.user_name = view.Rows[e.RowIndex].Cells["学员姓名"].Value.ToString();
            entity.user_lxr = view.Rows[e.RowIndex].Cells["联系人"].Value.ToString();
            entity.user_gddh = (view.Rows[e.RowIndex].Cells["固定电话"] != null) ? view.Rows[e.RowIndex].Cells["固定电话"].Value.ToString() : view.Rows[e.RowIndex].Cells["手机号码"].Value.ToString();
            entity.user_depname = view.Rows[e.RowIndex].Cells["分校"].Value.ToString();
            entity.user_address = view.Rows[e.RowIndex].Cells["家庭住址"].Value.ToString();
            return entity;
        }

        private void InitializeComponent()
        {
            base.SuspendLayout();
            base.AutoScaleDimensions = new SizeF(6f, 12f);
//            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x2b6, 0x103);
            base.Name = "FrmStuItem";
            base.ResumeLayout(false);
        }

        public override void ShowData(string tmpno,string time)
        {
            base.dataGridView1.DataSource = base.yhxxdao.GetStuInfo8no(tmpno,time);
            if (base.dataGridView1.DataSource == null) return;
            base.dataGridView1.Columns["学员信息流水"].Visible = false;
        }
    }

 

}
